{extend name="public/base"}

{block name="x-body"}
<div class="x-body">
    <form class="layui-form">
        {if $id}
         <input type="hidden" name="id" value="{$res.id}">
        {/if}

        <div class="layui-form-item">
            <label for="name" class="layui-form-label">
                分类名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="name" value="{$res.name}" required="" lay-verify="required"
                       autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="x-red">*</span>
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="desc" class="layui-form-label">
                分类描述
            </label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="desc" name="desc" class="layui-textarea">{$res.desc}</textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                {$id ? '修改' : '增加'}
            </button>
        </div>
    </form>
</div>
<script>
    formData('{:url("article/cate_form")}', 'add', function (){
        parent.location.reload();
        // 获得frame索引
        var index = parent.layer.getFrameIndex(window.name);
        //关闭当前frame
        parent.layer.close(index);
    }, false);
</script>
{/block}